package com.test.utils.dao;

public class DBUtils {

	public static String generateDBIdentifierFromName(final String name) {
		final StringBuilder sb = new StringBuilder();
		Character lastChar = null;
		for (char c : name.trim().toLowerCase().toCharArray()) {
			if (c == ' ') {
				if (lastChar == null || lastChar != ' ') {
					sb.append('_');
				}
				lastChar = ' ';
				continue;
			}
			sb.append(c);
			lastChar = c;
		}
		return sb.toString();
	}
}
